package org.cskt.sl.sys.service.impl;

import java.util.List;

import org.cskt.sl.sys.dao.DictionaryMapper;
import org.cskt.sl.sys.entity.Dictionary;
import org.cskt.sl.sys.example.DictionaryExample;
import org.cskt.sl.sys.service.DictionaryService;
import org.cskt.sl.util.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class DictionaryServiceImpl implements DictionaryService {

	@Autowired
	private DictionaryMapper dictionaryMapper;
	
	@Override
	public int countByExample(DictionaryExample example) {
		// TODO Auto-generated method stub
		return dictionaryMapper.countByExample(example);
	}

	@Override
	public int deleteDictionaryById(Integer did) {
		// TODO Auto-generated method stub
		return dictionaryMapper.deleteByPrimaryKey(did);
	}

	@Override
	public int addDictionary(Dictionary record) {
		// TODO Auto-generated method stub
		return dictionaryMapper.insertSelective(record);
	}

	@Override
	public List<Dictionary> findDictionaryPageList(DictionaryExample example, Pager pager) {
		// TODO Auto-generated method stub
		return dictionaryMapper.selectByExample(example, (pager.getCurrentPage()-1)*pager.getPageSize(), pager.getCurrentPage()*pager.getPageSize());
	}

	@Override
	public Dictionary getDictionaryById(Integer did) {
		// TODO Auto-generated method stub
		return dictionaryMapper.selectByPrimaryKey(did);
	}

	@Override
	public int updateDictionaryById(Dictionary record) {
		// TODO Auto-generated method stub
		return dictionaryMapper.updateByPrimaryKey(record);
	}

}
